<html>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<head>
<title>Section 1.1.&nbsp; PHP and MySQL's Place in Web Development</title>
<link rel="STYLESHEET" type="text/css" href="images/style.css">
<link rel="STYLESHEET" type="text/css" href="images/docsafari.css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-1.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-1-SECT-2.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
<br><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top"><a name="learnphpmysql-CHP-1-SECT-1"></a>
<h3 id="631368-883" class="docSection1Title">1.1. PHP and MySQL's Place in Web Development</h3>
<a name="IDX-CHP-1-0011"></a> 
<a name="IDX-CHP-1-0012"></a> 
<a name="IDX-CHP-1-0013"></a> 

<p class="docText">PHP is a programming language designed to generate web pages interactively on the computer serving them, called a <span class="docEmphasis">web server</span><a name="IDX-CHP-1-0014"></a> 
. Unlike HTML, where the web browser uses tags and markup to generate a page, PHP code runs between the requested page and the web server, adding to and changing the basic HTML output. For example, PHP code could be used to display a counter of visitors to a site.</p>
<p class="docText">PHP, in less than 20 lines of code, can store the IP address from which a page request comes in a separate file, and then display the number of unique IP addresses that visited a particular site. The person requesting the web page doesn't know that PHP generated the page, because the counter text is part of the standard HTML markup language that the PHP code generated.</p>
<p class="docText">PHP makes web development easy, because all the code you need is contained within the PHP framework. This means that there's no reason for you to reinvent the wheel each time you sit down to develop a PHP program; that would be something you'd have to do if you were using a compiled language like C.</p>
<p class="docText">While PHP is great for developing web functionality, it is not a database. The database of choice for PHP developers is MySQL, which acts like a filing clerk for PHP-processed user information. MySQL automates the most common tasks related to storing and retrieving specific user information based on your supplied criteria.</p>
<p><table border="0" bgcolor="black" cellspacing="0" cellpadding="1" width="90%" align="center"><tr><td><table bgcolor="white" width="100%" border="0" cellspacing="0" cellpadding="6"><tr><td width="60" valign="top"><img src="images/tip_yellow.jpg" width="50" height="54" alt=""></td><TD valign="top">
<p class="docText">Take our Amazon example; the recommendations Amazon offers you can be stored in a MySQL database, along with your prior order information.</p>
</td></TR></table></TD></tr></table></P><br>
<p class="docText">MySQL is easily accessed from PHP, and they're commonly used together as they work well hand in hand. An added benefit is that PHP and MySQL run on various computer types and operating systems, including Mac OS X, Windows-based PCs, and Linux.</p>
<a name="learnphpmysql-CHP-1-SECT-1.1"></a>
<h4 id="title-IDAFFSKN" class="docSection2Title">1.1.1. Advantages of Using PHP with MySQL</H4>
<a name="IDX-CHP-1-0015"></a> 
<a name="IDX-CHP-1-0016"></a> 
<a name="IDX-CHP-1-0017"></a> 

<p class="docText">There are several factors that make using PHP and MySQL together a natural choice:</p>
<dl class="docList">
<dt><br><P><span class="docPubcolor"><span class="docEmphasis">PHP and MySQL work well together</span></span></p></dt>
<dd><p class="docList">PHP and MySQL have been developed with each other in mind, so they are easy to use together. The programming interfaces between them are logically paired up. Working together wasn't an afterthought when the developers created the PHP and MySQL interfaces.</p></dd>

<dt><BR><p><span class="docPubcolor"><span class="docEmphasis">PHP and MySQL have open source power</span></span></p></dt>
<dd><p class="docList">As they are both open source projects, PHP and MySQL can both be used for free. MySQL client libraries are no longer bundled with PHP. Advanced users have the ability to make changes to the source code, and therefore, change the way the language and programs work.</p></dd>

<dt><br><P><span class="docPubcolor"><span class="docEmphasis">PHP and MySQL have community support</span></span></P></dt>
<dd><p class="docList">There are active communities on the Web in which you can participate and they'll answer your questions. You can also purchase professional support for MySQL if you need it.</p></dd>

<dt><br><p><span class="docPubcolor"><span class="docEmphasis">PHP and MySQL are fast</span></span></p></dt>
<dd><p class="docList">Their simplicity and efficient design enables faster processing.</P></dd>

<dt><br><P><span class="docPubcolor"><span class="docEmphasis">PHP and MySQL don't bog you down with unnecessary details</span>.</span></p></dt>
<dd><p class="docList">You don't need to know all of the low-level details of how the PHP language interfaces with the MySQL database, as there is a standard interface for calling MySQL procedures from PHP. Online APIs at <a class="docLink" target="_blank" href="http://www.php.net">http://www.php.net</a> offer an unlimited resource.</P></dd>
</dl>

<a name="learnphpmysql-CHP-1-SECT-1.2"></a>
<H4 id="title-IDATHSKN" class="docSection2Title">1.1.2. The Value of Open Source</H4>
<a name="IDX-CHP-1-0018"></a> 
<a name="IDX-CHP-1-0019"></a> 

<p class="docText">As we mentioned above, both PHP and MySQL are open source<a name="IDX-CHP-1-0020"></a> 
 projects, so there's no need to worry about user licenses for every computer in your office or home. In open source projects and technologies, programmers have access to the source code; this enables individual or group analysis to identify potentially problematic code, test, debug, and offer changes as well as additions to that code. For example, Unixthe forerunner in the open source software communitywas freely shared with university software researchers. Linux, the free alternative to Unix, is a direct result of their efforts and the open source licensing paradigm.</p>
<p class="docText">As Tim O'Reilly puts it, "Open source licensing began as an attempt to preserve a culture of sharing, and only later led to an expanded awareness of the value of that sharing." Today, open source programmers share their code changes on the Web via <a class="docLink" target="_blank" href="http://php.net">php.net</a>, listservs, and web sites. If you're caught in a coding nightmare and can't wake up, the resources mentioned above can and will help you.</p>
<p><table border="0" bgcolor="black" cellspacing="0" cellpadding="1" width="90%" align="center"><tr><td><table bgcolor="white" width="100%" border="0" cellspacing="0" cellpadding="6"><tr><td width="60" valign="top"><img src="images/tip_yellow.jpg" width="50" height="54" alt=""></td><td valign="top">
<p class="docText">We'll arm you with open source user forums later in this book so you can check them out yourself. We'll include listservs and web sites so that you have numerous resources if you run into a snafu.</p>
</td></tr></table></td></tr></table></P><br>


</TD></TR></table>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-1.html><img src="images/prev.gif" width="60" height="17" border="0" align="absmiddle" alt="Previous Page"></a>
<td align="right"><div STYLE="MARGIN-LEFT: 0.15in;">
<a href=learnphpmysql-CHP-1-SECT-2.html><img src="images/next.gif" width="60" height="17" border="0" align="absmiddle" alt="Next Page"></a>
</div></td></tr></table>
<script type="text/javascript"><!--
google_ad_client = "pub-0203281046321155";
google_alternate_ad_url = "http://www.bookhtml.com/adbrite.htm";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel ="4867465545";
google_color_border = "FFFFFF";
google_color_link = "0000FF";
google_color_bg = "FFFFFF";
google_color_text = "000000";
google_color_url = "0000FF";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</html>
